]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspace: Ensure that _createBestLayout() always returns a layout
authorSebastian Keller <skeller@gnome.org>
Tue, 16 Feb 2021 12:37:17 +0000 (13:37 +0100)
committerMarge Bot <marge-bot@gnome.org>
Tue, 16 Feb 2021 21:24:27 +0000 (21:24 +0000)
When opening a large number of windows, the computed space and scale for
a layout can become negative due to the per-row/per-column spacing. This
is smaller than the initial values of lastSpace and lastSpace, leading
to a null return which then causes all sorts of other issues resulting
in the workspace becoming invisible.

This change ensures that the function always returns a layout, even if
it may look a bit broken and does not conform to the scale/space
requirements which are impossible to fulfill for the given number of
windows. It's better than displaying nothing, since it allows users to
move/close windows and restore this to a more usable state.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3730

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1685>

js/ui/workspace.js

index f9f9e51ee28affb641033276b869fac9a482dd83..6bf5cfe26f7c628188cdaec474791c765a87ee5d 100644 (file)
@@ -518,7 +518,7 @@ var WorkspaceLayout = GObject.registerClass({
 
             const [scale, space] = this._layoutStrategy.computeScaleAndSpace(layout, area);
 
-            if (!this._isBetterScaleAndSpace(lastScale, lastSpace, scale, space))
+            if (lastLayout && !this._isBetterScaleAndSpace(lastScale, lastSpace, scale, space))
                 break;
 
             lastLayout = layout;